<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:th="http://www.thymeleaf.org"
	  xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
	  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<script th:inline="javascript">
	/*<![CDATA[*/
    $(function(){
        middlegroup.ns('middlegroup.admin.menu[[${OP.menuId}]]');
        $('#admin_menu[[${OP.menuId}]]_datagrid').bootstrapTable({
            url:[[${MENU.channel}]]+'/query',
            height: '100%',
            sortName: 'addTime',
            sortOrder: 'desc',
            striped: true,
            pagination: true,
            pageSize: 10,
            pageList: [10, 25, 50, 100, 200],
            search: false,
            sidePagination:'server',
            idField: 'id',
            uniqueId: 'id',
            responseHandler: responseHandler,
            queryParams: queryParams,
            minimumCountColumns: 2,
            clickToSelect: true,
            searchAlign: 'left',
            columns: [{
                checkbox: true
            },{
                field: 'merchantCode',
                title: '所属商户',
                align: 'center',
                valign: 'middle'
            }, {
                field: 'merchantBillNo',
                title: '商户订单号',
                align: 'center',
                valign: 'middle'
            }, {
                field: 'merchantRefundNo',
                title: '商户退款单号',
                align: 'center',
                valign: 'middle'
            } ,{
                field: 'refundNo',
                title: '平台退款单号',
                align: 'center',
                valign: 'middle'
            },{
                field: 'amount',
                title: '退款金额',
                align: 'center',
                valign: 'middle'
            },{
                field: 'refundTime',
                title: '退款时间',
                align: 'center',
                valign: 'middle',
                sortable: true,
                formatter:function(value,row,index){return new Date(value).pattern("yyyy-MM-dd HH:mm:ss")}
            },{
                field: 'status',
                title: '退款状态',
                formatter: function (value, row,index) {
                    if (value == "0") {
                        return '处理中';
                    }
                    if (value == "1") {
                        return '成功';
                    }
                    if (value == "2") {
                        return '失败';
                    }
                },
                align: 'center',
                valign: 'middle'
            },{
                field: 'msg',
                title: '交易信息',
                align: 'center',
                valign: 'middle'
            }, {
                field: 'addTime',
                title: '创建时间',
                align: 'center',
                valign: 'middle',
                sortable: true,
                formatter:function(value,row,index){return new Date(value).pattern("yyyy-MM-dd HH:mm:ss")}
            } ]
        });
    })

    // 传递的参数
    function queryParams(params) {
        return {
            pageSize : params.limit,
            pageNum : params.offset / params.limit + 1,
            sort : params.sort,
            order : params.order,
            beginTime:$("#begin_time").val(),
            endTime:$("#end_time").val(),
            refundNo:$("#refundNo").val(),
            merchantRefundNo:$("#merchantRefundNo").val(),
            status:$("#status").val()
        }
    }
    //查询
    middlegroup.admin.menu[[${OP.menuId}]].search = function(){
        $('#admin_menu[[${OP.menuId}]]_datagrid').bootstrapTable('refresh');
    }


    $('.form_date').datetimepicker({
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });

	/*]]>*/
</script>

<div class="wrapper wrapper-content animated fadeInRight">
	<div class="ibox float-e-margins">
		<div class="ibox-content">
			<div class="panel panel-default">
				<div class="panel-body">
					<form id="formSearch" class="form-horizontal">
						<div class="form-group" style="margin-top: 15px">
							<label class="control-label col-sm-1">商户退款单号</label>
							<div class="col-sm-2">
								<input type="text" class="form-control" id="merchantRefundNo" />
							</div>
							<label class="control-label col-sm-1">平台退款单号</label>
							<div class="col-sm-2">
								<input type="text" class="form-control" id="refundNo" />
							</div>

							<label class="control-label col-sm-1">状态</label>
							<div class="col-sm-2">
								<select class="form-control m-b" name="status" id="status">
									<option value="" selected="selected">-请选择-</option>
									<p></p>
									<option value="0">处理中</option>
									<option value="1">成功</option>
									<option value="2">失败</option>
								</select>
							</div>
							
							
							<div class="form-group">
								<label class="control-label col-sm-1">开始日期</label>
								<div class="input-group date form_date col-md-2" data-date-format="yyyy-mm-dd"  data-link-format="yyyy-mm-dd">
									<input class="form-control" size="16" type="text" value="" readonly id="begin_time">
									<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
								</div>
								<label class="control-label col-sm-1">结束日期</label>
								<div class="input-group date form_date col-md-2"  data-date-format="yyyy-mm-dd"  data-link-format="yyyy-mm-dd">
									<input class="form-control" size="16" type="text" value="" readonly id="end_time">
									<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
								</div>
							</div>
							<div class="col-sm-4" style="text-align: left;">
								<button type="button"
										th:onclick="@{middlegroup.admin.menu{menuId}.search()(menuId=${OP.menuId})}"
										class="btn btn-primary">查询</button>
							</div>
						</div>
						<p shiro:hasRole="manager"> 有角色</p>
						<p shiro:hasPermission ="sys:refundBills:list">有操作权限</p>
					</form>
				</div>
			</div>
			<div th:include="toolbar :: toolbar-operate"></div>
			<div class="table-responsive">
				<table th:id="@{admin_menu{menuId}_datagrid(menuId=${OP.menuId})}"
					   data-toolbar="#toolbar" data-show-refresh="true"
					   data-show-toggle="true" data-show-columns="true"
					   data-show-footer="false" data-mobile-responsive="true">
				</table>
			</div>
		</div>
	</div>
</div>
</html>